Object Commands


With object-related commands you can handle display status and position of objects in your project. There are also two object-related commands for text loading/changing.

 

Hide("ObjectLabel")
Description
 


Hides object specified using label as a command parameter.

Both individual objects and object groups can be hidden using this command. Object or Group label that should be hidden is specified as parameter inside parenthesis and double quotes.

Code Examples
 

** Hide object labeled "Button" :
Hide("Button")

** Hide group of objects labeled "GroupOfButtons" :
Hide("GroupOfButtons")

Additional Info
 
Visible PlugIns cannot be hidden using this command. To hide visual PlugIns, use their (PlugIn-specific) commands for window hiding.

 

Show("ObjectLabel")
Description
 


Shows object specified using label as a command parameter.

Both individual objects and object groups can be displayed using this command. Object or Group label that should be displayed is specified as parameter inside parenthesis and double quotes.

Code Examples
 

** Show object labeled "Button" :
Show("Button")

** Show group of objects labeled "GroupOfButtons" :
Show("GroupOfButtons")

Additional Info
 
If hidden, visible PlugIns cannot be displayed using this command, so use their (PlugIn-specific) commands for window hiding.

 

Invert("ObjectLabel")
Description
 


Inverts display status of object specified using label as a command parameter. If object was hidden, it will be displayed. If object was displayed, it'll be hided.


Both individual objects and object groups can be inverted using this command. Object or Group label that should be inverted is specified as parameter inside parenthesis and double quotes.

Code Examples
 

** Invert object labeled "Button" :
Invert("Button")

** Invert group of objects labeled "GroupOfButtons" :
Invert("GroupOfButtons"

Additional Info
 
Display status of visible PlugIns cannot be inverted using this command, so use their (PlugIn-specific) commands for display status.

 

MoveObject("ObjectLabel","x,y[,w,h]")
Description
 


Moves and resizes object specified using label as a first command parameter to position and size set through coordinates & size values as second command parameter.

MoveObject("ObjectLabel","x,y,w,h")

Second parameter consits of 4 values:

x - horizontal position of object in pixels (required)
y - vertical position of object in pixels (required)
w - width of object in pixels (optional)
h - width of object in pixels (optional)


Both individual objects and object groups can be moved using this command. Object or Group label that should be moved is specified as parameter inside parenthesis and double quotes. Only individual objects can be resized using MoveObject command.

Second parameter can either have only size values:

MoveObject("Bitmap","139,130")

...or both size and dimension values:

MoveObject("Bitmap","139,130,97,95")

Code Examples
 

** Move object labeled "Bitmap" without resizing:
MoveObject("Bitmap","201,325")

** Move object labeled "Bitmap" with resizing:
MoveObject("Bitmap","201,325,38,11")

**Move group of objects labeled "GroupOfBitmaps" :
MoveObject("GroupOfBitmaps","150,50")

** Move object labeled "Bitmap" with resizing using numerical variables:
MoveObject("Bitmap","xpos,ypos,width,height")
Additional Info
 
Combining MoveObject command with MouseX() and MouseY() constants and for..next loops can give interesting results - objects can be moved real-time, as user moves mouse pointer.

 

MoveTo("ObjectLabel","Parameters")
Description
 


Moves object specified using label as a first command parameter to position set through coordinates and movement animation properties as second command parameter.

MoveTo("ObjectLabel","x,y,Steps,AnimType")

Second parameter consits of 4 values:

x - horizontal position of object in pixels (required)
y - vertical position of object in pixels (required)

Steps - number of steps that should be used for movement animation - lower value makes movement faster, higher value makes animation smoother and slower)

AnimType - sets type of movement animation. Available types are:

  •   EASYTO (starts with faster movement and slows down as it reaches  the destination coordinates),
  •   EASYFROM (starts with slower movement and speeds up as it  reaches destination coordinates)


Both individual objects and object groups can be moved using this command. Object or Group label that should be moved is specified as parameter inside parenthesis and double quotes.

Code Examples
 

** Move object labeled "Bitmap" with 40 steps (slow) and
**slower animation on start of movement:

MoveTo("Bitmap","201,325,40,EASYFROM")

** Move object labeled "Bitmap" with 10 steps (fast) and
**slower animation on end of movement:

MoveTo("Bitmap","201,325,40,EASYTO")

** Move object labeled "Bitmap" using numerical variables and
**slower animation on end of movement:

MoveTo("Bitmap","xpos,ypos,steps,EASYTO")

** Move group of objects labeled "BitmapGroup" with 20 steps (medium) **and slower animation on start of movement:
MoveTo("BitmapGroup","201,325,20,EASYFROM")

Additional Info
 
Combining MoveTo command with MouseX() and MouseY() constants and for..next loops can give interesting results - objects can be moved real-time, as user moves mouse pointer.

 

DisplayValue("ObjectLabel","Value")
Description
 


Loads content of string or numerical variable into either text object or button object. First parameter sets object label where content of the variable will be displayed. Second parameter sets source variable where content comes from.

 

Code Examples
 

** Displaying content of string variable in text object NameLabel:
name$='Little Joe'
DisplayValue("NameLabel","name$")

** Displaying content of numerical variable in text object AgeLabel:
age=47
DisplayValue("AgeLabel","age")

** Displaying content of string variable in button object TextBTN:
Item$='File'
DisplayValue("TextBTN","Item$")

Additional Info
 
This command should be used for short strings only. To load text paragraphs, use LoadText command.

 

LoadText("ObjectLabel","String")
Description
 


Loads content of string variable, external file or text set as second parameter into any text, button, editbox or paragraph object.

LoadText("ObjectName","TextSource")

First parameter sets object label where content will be displayed. Second parameter sets one of multiple text sources:

- string variable (txt$, var$)
- text file (<SrcDir>\MyStory.txt)
- Song List (<List>5)
- fixed text as second parameter

 

Code Examples
 

** Loading text to Paragraph from text$ string variable:
LoadText("Paragraph","text$")

** Loading text to Paragraph from text file story.txt in <SrcDir>:
LoadText("Paragraph","<SrcDir>\story.txt")

** Loading text to Paragraph from MMB's Song List, item 7 :
LoadText("Paragraph","<List>7")

** Loading text to Paragraph from fixed text in second parameter:
LoadText("Paragraph","Hello MMB")

** Loading text to EditBox from input$ string variable:
LoadText("EditBox","input$")

Additional Info
 

MMB recognizes folder path & file name in second parameter as a source file for text that should be loaded. Sometimes all you want to do is display a path in the text object, not load it's content. To control LoadText behaviour in such case, use these parameters in front of the variable:

STRING - instructs command to handle source contents as a string:

LoadText("Paragraph","STRING:File$")

FILE - instructs command to handle source contents as a file:

LoadText("Paragraph","FILE:File$")

Examples above use File$ variable that contains a file path.
In the first case, path will only be displayed in destination text object.
In the second case, path will be used as a source file for text.

 

MMB Scripting Unleashed by Bokzy, 2003 :: All rights reserved :: http://www.bokzy.com